package cate.game.train.hero.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import easy.java.dev.note.NoteField;

import java.util.Set;

@ClientMsg(title = "英雄继承 の 请求")
@OperationSetter(GDOperation.HERO_INHERIT)
public class HeroInheritReq implements MsgInput {
    @NoteField(value = "被继承的uid")
    public String inheritUid;

    @NoteField(value = "选择的5星英雄uid")
    public Set<String> selectUids;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = game.train.hero.inherit(cc.getRole(), inheritUid, selectUids);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.HERO_TRANSFER_REQ;
    }
}
